package com.qidian.mes.wm.service.impl;

import com.qidian.mes.wm.mapper.WareMapper;
import com.qidian.mes.wm.service.WareService;
import com.qidian.mes.wm.vo.WareVO;
import com.qidian.mes.util.pojo.QdResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: 小可怎么都睡不够
 * @Description:
 * @Time: 2024-04-13 09:41
 **/
@Service
public class WareServiceImpl implements WareService {
    @Autowired
    WareMapper mdWareMapper;

    @Override
    public QdResult addWare(WareVO ware) {
        mdWareMapper.addWare(ware);
        return QdResult.success("success");
    }

    @Override
    public QdResult deleteWare(Integer wareId, Integer status) {
        mdWareMapper.deleteWare(wareId, status);
        return QdResult.success("success");
    }

    @Override
    public QdResult updateWare(WareVO ware) {
        mdWareMapper.updateWare(ware);
        return QdResult.success("success");

    }

    @Override
    public QdResult getWareById(String wareName, Integer page, Integer limit) {
        return QdResult.success(mdWareMapper.getWareByName(wareName, (page - 1) * limit, limit));
    }

    @Override
    public QdResult deleteWareByIds(Integer[] ids) {
        mdWareMapper.deleteWareByIds(ids);
        return QdResult.success("success");
    }

    @Override
    public QdResult getWareCount(String wareName) {
        return QdResult.success(mdWareMapper.getCount(wareName));
    }
}
